package cfca.seal.util;

import cfca.itool.util.IoUtil;
import cfca.seal.exception.CodeException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;

public class FileUtil
{
  public static byte[] getBytesFromInputStream(InputStream inputStream)
    throws IOException
  {
    ByteArrayOutputStream bos = new ByteArrayOutputStream(inputStream.available());
    BufferedInputStream in = null;
    try {
      in = new BufferedInputStream(inputStream);
      int buf_size = 1024;
      byte[] buffer = new byte[buf_size];
      int len = 0;
      while (-1 != (len = in.read(buffer, 0, buf_size))) {
        bos.write(buffer, 0, len);
      }
      return bos.toByteArray();
    } catch (IOException e) {
      throw e;
    } finally {
      try {
        in.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
      bos.close();
    }
  }

  public static byte[] getBytesFromFile(File f)
  {
    if (f == null)
      return null;
    try
    {
      FileInputStream stream = new FileInputStream(f);

      return getBytesFromInputStream(stream);
    } catch (IOException e) {
    }
    return null;
  }

  public static byte[] getFileFromHttpUrl(String urlString)
  {
    try {
      URL url = new URL(urlString);
      HttpURLConnection conn = (HttpURLConnection)url.openConnection();
      conn.setDoInput(true);

      InputStream inputStream = conn.getInputStream();

      return IoUtil.read(inputStream);
    }
    catch (IOException e)
    {
    }

    return null;
  }

  public static void saveDataToFile(byte[] data, String filePath) throws CodeException {
    if ((data != null) && (data.length > 0)) {
      FileOutputStream fileOutputStream = null;
      try {
        fileOutputStream = new FileOutputStream(filePath);
        fileOutputStream.write(data);
        fileOutputStream.flush();
      } catch (Exception e) {
        throw new CodeException("C3017", "写文件错误", e);
      } finally {
        if (fileOutputStream != null)
          try {
            fileOutputStream.close();
          } catch (IOException e) {
            e.printStackTrace();
          }
      }
    }
  }

  public static void copyFile(File sourceFile, File targetFile)
    throws IOException
  {
    BufferedInputStream bufferedInputStream = null;
    BufferedOutputStream outBuff = null;
    try
    {
      bufferedInputStream = new BufferedInputStream(new FileInputStream(sourceFile));

      outBuff = new BufferedOutputStream(new FileOutputStream(targetFile));

      byte[] b = new byte[4096];
      int len;
      while ((len = bufferedInputStream.read(b)) != -1) {
        outBuff.write(b, 0, len);
      }

      outBuff.flush();
    }
    finally {
      if (bufferedInputStream != null)
        bufferedInputStream.close();
      if (outBuff != null)
        outBuff.close();
    }
  }

  public static void replaceFile(String removeFile, String editFile) {
    boolean removeFlag = false;
    File p7bNew = new File(removeFile);
    if (p7bNew.exists()) {
      while (!removeFlag) {
        removeFlag = p7bNew.delete();
      }
    }

    File p7bFileBack = new File(editFile);

    if (p7bFileBack.exists()) {
      boolean renameFlag = false;
      while (!renameFlag)
        renameFlag = p7bFileBack.renameTo(p7bNew);
    }
  }

  public static void deleteFile(String removeFilePath)
  {
    boolean removeFlag = false;
    File removeFile = new File(removeFilePath);
    if (removeFile.exists())
      while (!removeFlag)
        removeFlag = removeFile.delete();
  }

  public static boolean deleteSingleFile(String sPath)
  {
    Boolean flag = Boolean.valueOf(false);
    File file = new File(sPath);

    if ((file.isFile()) && (file.exists())) {
      file.delete();
      flag = Boolean.valueOf(true);
    }
    return flag.booleanValue();
  }

  public static boolean deleteDirectory(String sPath)
  {
    if (!sPath.endsWith(File.separator)) {
      sPath = sPath + File.separator;
    }
    File dirFile = new File(sPath);

    if ((!dirFile.exists()) || (!dirFile.isDirectory())) {
      return false;
    }
    Boolean flag = Boolean.valueOf(true);

    File[] files = dirFile.listFiles();
    for (int i = 0; i < files.length; i++)
    {
      if (files[i].isFile()) {
        flag = Boolean.valueOf(deleteSingleFile(files[i].getAbsolutePath()));
        if (!flag.booleanValue())
          break;
      }
      else {
        flag = Boolean.valueOf(deleteDirectory(files[i].getAbsolutePath()));
        if (!flag.booleanValue())
          break;
      }
    }
    if (!flag.booleanValue()) {
      return false;
    }
    if (dirFile.delete()) {
      return true;
    }
    return false;
  }

  public static List<String> showAllFiles(File dir, List<String> filePath, String type)
    throws Exception
  {
    File[] fs = dir.listFiles();
    for (int i = 0; i < fs.length; i++) {
      if (fs[i].isDirectory()) {
        showAllFiles(fs[i], filePath, type);
      }
      else if (fs[i].getAbsolutePath().contains(type)) {
        filePath.add(fs[i].getAbsolutePath());
      }
    }

    return filePath;
  }

  public static void uploadFile(byte[] pdfFile, String uploadFiles, String fileName) {
    File file = new File(uploadFiles, fileName);
    File uploadFilesFlag = new File(uploadFiles);
    if (!uploadFilesFlag.isDirectory()) {
      uploadFilesFlag.mkdirs();
    }
    if (file.exists())
      file.delete();
    try
    {
      FileOutputStream fos = new FileOutputStream(file);
      fos.write(pdfFile, 0, pdfFile.length);
      fos.flush();
      fos.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  public static void main(String[] args) throws Exception
  {
    String data = "Q0ZDQVNFQUxJRAIAAQD/IgAAXw8AADCAAgEDMIAGCSqGSIb3DQEHAaCAJIAEggQMMIAwgAYJKoZIhvcNAQcBoIAkgASCAuEwggPqMIID5gYLKoZIhvcNAQwKAQKgggKxMIICrTAnBgoqhkiG9w0BDAEDMBkEFIhJMUUKv/Q6xM7qWHRIN2HDOwbFAgFkBIICgJ43umd/ZPRRNL/w+pSq4Al1E3h67fKLeHJPuYVVEC4shjhjjnSt/85zds085HyxuKuCsU2s07gfT+E0fBmcpiBRQb5kwNB6agcuWPItWYpcfMkVWFW0NbXUFEiORYtEylvJTA1npuupGUJhsWLMr2I4prRPFLsbSg14mIRuyRUC9GymF6sSPDUJye6DYFgxHxNcw4/RDNQLzBvyElGTUh1HDTucpxzHYVwqptlVvSlgrfVAzqKCasp96SvlNNu737dpuqO+jrNUp9KY5SZsjyKe9mf3+RTWl724oO/SSESjzI2FRw9j3elFxt9+34hnUEqxeFOYARSeOs/sdKCphKLskxekgNFBlMjbS7uJVK2zw9HZq8U7EopSc8srPNRP/4s8orzNl022u0VdRQqgjCDA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LeByrRa1mgDESm3bunnjhuFSqVTu6e3r71eKQMQi0joLQcB2Vt3Xbk/8YslgYa0OgGySpnEYpxClcRq3l6rV1EgUtqy1KdhiLquV6/peEGSDwAuCoKPrsJoAP/HMXypcAYtdqwIArAAgkADYjrcJnV11p8H2Mmt2FclqC3F1okAMAK1987M1qn4OuOv6mZ321irNKAByuR0EAGAJcK0HKNjZBnQjFaD1hWXBEDC8ZvwipdadRDGA0rXcoIsJgDr/Fun0ZVcHtpry3dGu7l8vt2bXk/FLhLuWcasvhrU28Joxv9qIvCxMLzvBdFuInYSxq/BeSxDW4v8AjJSUhLfhRisAAAAASUVORK5CYIICAAAAZG0EAAAAY2ZjYQEAAAAxVgAAAENOPTA0MUBDZGV2VGVzdDAxQGRldlRlc3QwMUAwMDAwMDAwMSwgT1U9RW1wbG95ZWVzLCBPVT1kZXZUZXN0MDEsIE89Q0ZDQSBURVNUIENBLCBDPUNOyedeTgAAAADJbEFQAAAAAAzICok4LbBAeiRv1EUKXL6aJYIc";
    byte[] temp = getBytesFromInputStream(new FileInputStream("C:\\Users\\admin\\Desktop\\pdf\\1.seal"));
    System.out.println(new String(temp).equals(data));
  }
}